<template>
	<view>
		<scroll-view scroll-x class="bg-white nav">
			<view class="header flex text-center">
				<button @tap="GetNewOrderNo(false)">创建新单</button>
				<button @tap="sureClear">清空单据</button>
				<button @tap="lookOrder()">查询单据</button>
				<button @tap="isChangeOrder()" v-if="!isChange">提交单据</button>
				<button @tap="isChangeOrder()" v-if="isChange">修改单据</button>
			</view>
			<view class="main">
				<view class="main-box">
					<form>
						<view v-if="TabCur ==0" class="cg-main">
							<view  class="tabHeader" :class="isLookHeaderMore||BillType==18?'tabHeaderMore':''">
								<view class="cu-form-group">
									<view class="title">*单据编号:</view>
									<input class="inpt" disabled="true" name="input" :value="BillNo" placeholder="创建新单获取单号"></input>
								</view>
								<view class="cu-form-group">
									<view class="title">*单据日期:</view>
									<!-- <view class="inpt1">
										<input disabled="true" :value="BillDate"></input>
									</view> -->
									<picker mode="date" :value="BillDate" @change="DateChangeVal">
										<view class="picker">
											{{BillDate}}
										</view>
									</picker>
								</view>
								<view class="cu-form-group" v-if="BillType==18">
									<view class="title">*{{BillType==18?'充值金额':BillType==12?'付款金额':"收款金额"}}:</view>
									<input class="inpt" name="input" placeholder="" v-model="parForMoney"></textarea>
								</view>
								<view class="cu-form-group" v-if='BillType!=18'>
									<view class="title">*往来单位:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectClientObj.ClientName" disabled="true"
										 style="text-align: left;"  @tap="AddClientListen" />
									</view>
								</view>
								<view class="cu-form-group" v-show="BillType==18">
									<view class="title">*会&nbsp;员&nbsp;卡&nbsp;&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectVipObj.MemberCode" disabled="true"
										 style="text-align: left;"  @tap="AddVipListen" /></view>
								</view>
								<view class="cu-form-group">
									<view class="title">制&nbsp;单&nbsp;人&nbsp;&nbsp;:</view>
									<input class="inpt" disabled="true" name="input" :value="CreateName" ></input>
								</view>
							
								<view class="cu-form-group">
									<view class="title">银行账号:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectBankObj.BankName" disabled="true"
										 style="text-align: left;" data-target="BankModal" @tap="showModal" />
										<view class="cu-modal" :class="modalName=='BankModal'?'show':''">
											<view class="cu-dialog">
												<view class="cu-bar bg-white justify-end">
													<view class="content">请选择银行账号</view>
													<view class="action" @tap="hideModal">
														<text class="cuIcon-close text-red"></text>
													</view>
												</view>
												<view class="padding-xl">
													<view class="searchStore">
														<input placeholder="请输入名称" v-model="SearchBankName" @input="filterBank"/>
														<button @tap="searchBank">搜索</button>
													</view>
													<view class="StoreListWrap">
														<view v-for="(item,index) in BankTempList" :key="item.BankID" @tap="selectBankName(index)">{{item.BankName}}</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="cu-form-group">
									<view class="title">收款方式:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectPayWayObj.name" disabled="true"
										 style="text-align: left;" data-target="PayWayModal" @tap="showModal" />
										<view class="cu-modal" :class="modalName=='PayWayModal'?'show':''">
											<view class="cu-dialog">
												<view class="cu-bar bg-white justify-end">
													<view class="content">请选择收款方式</view>
													<view class="action" @tap="hideModal">
														<text class="cuIcon-close text-red"></text>
													</view>
												</view>
												<view class="padding-xl">
													<view class="searchStore">
														<input placeholder="请输入名称" v-model="SearchPayWayName" @input="filterPayFor"/>
														<button @tap="searchPayWay">搜索</button>
													</view>
													<view class="StoreListWrap">
														<view v-for="(item,index) in PayTempForFs" :key="item.id" @tap="selectPayWay(index)">{{item.name}}</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="cu-form-group">
									<view class="title">业&nbsp;务&nbsp;员&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectOptionsObj.OperatorName" disabled="true"
										 style="text-align: left;" data-target="OptionsModal" @tap="showModal" />
										<view class="cu-modal" :class="modalName=='OptionsModal'?'show':''">
											<view class="cu-dialog">
												<view class="cu-bar bg-white justify-end">
													<view class="content">请选择业务员</view>
													<view class="action" @tap="hideModal">
														<text class="cuIcon-close text-red"></text>
													</view>
												</view>
												<view class="padding-xl">
													<view class="searchStore">
														<input placeholder="请输入业务员名称" v-model="SearchOptionName" @input="filterOption"/>
														<button @tap="searchOption">搜索</button>
													</view>
													<view class="StoreListWrap">
														<view v-for="(item,index) in TempOptionList" :key="item.OperatorID" @tap="selectOptions(index)">{{item.OperatorName}}</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>							
								<view class="cu-form-group">
									<view class="title">备&emsp;&nbsp;&nbsp;注&nbsp;:</view>
									<input class="inpt" name="input" placeholder="点击修改" v-model="Remark"></input>
								</view>
								<view class="cu-form-group lookHeaderMore" v-if='BillType!=18'>
									<view class="title" style="width: 100%;text-align: center;" @tap="lookHeaderMore()">{{TbHeaderMore}}</view>
								</view>
							</view>
							<view>
								<view class="searchInput" v-if='BillType!=18'>
									<view class="goodFilter">
										<!-- <uniIcon type="search" size="14" style="line-height: 28px;margin-left: 5px;margin-right: 5px;color: #a7aab3;" /> -->
										<input class="searchOption" confirm-type="search" type="text" disabled="true"></input>
									</view>
									<view class="searchOptions">
										<button class="giveSong" @tap="gogoodlist()"></button>
										<!-- <button class="getPicture" @tap="tel()"></button> -->
									</view>
								</view>
							</view>
							<!--商品明细列表-->
							<view class="selectGoodsList" v-for="(item,index) in OrderGoodsList" :key="index">
								<view class="goodListItem" :class="selectLookMore == index?'goodListItem lookMore':''">
									<view class="goodsTitle"><text>{{item.BillNo}}</text><button @tap="lookGoodsInfo(index)">{{selectLookMore==index?'收起':'查看'}}</button>
										<button @tap="deleteSelectGood(index)">删除</button></view>
									<view>
										<view class="goods-itemWrap">
											<text class="good-item">单据总金额:{{item.Amount | onlyTwoFloat}}</text>
											<!-- <text class="good-item">单位:{{item.UnitName}}</text> -->
										</view>
										<view class="goods-itemWrap">
											<text class="good-item">已结算金额:{{item.pamount | onlyTwoFloat}}</text>
											<!-- <text class="good-item">税率:{{item.Tax}}</text> -->
										</view>
										<view class="goods-itemWrap">
											<text class="good-item">未结算金额:{{item.Total | onlyTwoFloat}}</text>
										</view>
										<view class="goods-itemWrap goods-inpts">
											<text class="good-item">本次结算额:</text>
											<input type="number" v-model="item.payCount" style="border: 1px solid #ccc;padding-left: 5px;"/>
										</view>
									</view>
								</view>
							</view>
						</view>
					</form>
				</view>
			</view>
		</scroll-view>
		<view class="quiteTop" v-if="isShowTip" @tap="scrollTop">返回</br>顶部</view>
		<view class="cu-modal" :class="isShowScanModel?'show':''">
			<view class="cu-dialog ls-main">
				<view class="cu-bar bg-ls justify-between">
					<view class="action">
						<view class="cuIcon-info text-white" v-show="false"></view>
					</view>
					<view class="content text-white">选择商品</view>
					<view class="action" @tap="hideModal(0)">
						<text class="cuIcon-close text-white"></text>
					</view>
				</view>
				<view class="padding text-left bg-white ls-contain">
					<scroll-view scroll-y style="height: 400px;padding-bottom: 100px">
						<view class="ls-box" @tap="choosesGoods(index)" v-for="(item,index) in scanGoodList" :key='index' :data-index="index">
							<view>单据编号:{{item.BillNo}}</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</view>
		<view class="cu-modal" :class="isShowVipModel?'show':''">
			<view class="cu-dialog ls-main">
				<view class="cu-bar bg-ls justify-between">
					<view class="action">
						<view class="cuIcon-info text-white" v-show="false"></view>
					</view>
					<view class="content text-white">选择Vip客户</view>
					<view class="action" @tap="hideModal(1)">
						<text class="cuIcon-close text-white"></text>
					</view>
				</view>
				<view class="padding text-left bg-white ls-contain">
					<scroll-view scroll-y style="height: 400px;padding-bottom: 100px">
						<view class="ls-box" @tap="choosesVipUser(index)" v-for="(item,index) in VipUserList" :key='index' :data-index="index">
							<view>Vip客户名称:{{item.MemberName}}</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</view>
		<uni-calendar ref="calendar" :insert="false" @confirm="confirm" />
		<uni-calendar ref="calendar1" :insert="false" @confirm="confirm1" />
		<uni-calendar ref="calendar2" :insert="false" @confirm="confirm2" />
		<settingOption :settingObj="'setting'+BillType" :modalName="modalName"
		 @changeSetting="changeSetting" @ycDy="ycDy" @djSh="djSh" @PrintOrder="PrintOrder" @hideModal="hideModal" :modalNames="modalNames" @radioChange="radioChange"
		ref="settingOption" @changeSelectShow="changeSelectShow" @xpDy="xpDy"></settingOption>
	</view>
</template>
<script src="./js/add-order-gathering.js">

</script>

<style scoped>
	@import url("./css/add-order-gathering.css");
</style>
